package com.miracle.services.impls;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.miracle.mapper.EggOrdMapper;
import com.miracle.model.EggOrd;
import com.miracle.services.IEggOrd;

@Service
public class EggOrdImpl implements IEggOrd {
	
	@Autowired
	private EggOrdMapper mapper;

	@Override
	public List<Map<String, String>> getAllOrd() {
		return mapper.getAllOrd();
	}

	@Override
	public boolean createOrSave(Map<String, String> map, boolean isCreate) {
		if(isCreate) {
			return mapper.create(map) == 1 ? true : false;
		} else {
		return mapper.update(map) == 1 ? true : false;
		}
	}
	
	@Override
	public boolean delete(String ordId, String itmId) {
		return mapper.delete(ordId, itmId) == 1 ? true : false;
	}

	@Override
	public boolean batchSave(List<EggOrd> list) {
		return mapper.batchSave(list);
	}
	
	@Override
	public boolean batchInsert(List<EggOrd> list) {
		return mapper.batchInsert(list);
	}
	
	@Override
	public boolean headInsert(String nm, String src, String ordId, String tel) {
		return mapper.headInsert(nm, src, ordId, tel);
	}

	@Override
	public boolean updateHead(Map<String, String> para) {
		return mapper.updateHead(para) == 1 ? true : false;
	}
}
